import logging

from kafka import KafkaConsumer
from APP.Kafka.Kafka_data import loopReceiveData

isLoopReceiveData = False
kafka_offset_reset = 'largest'


def receiveKafka():
    from APP.Kafka import topic, bootstrap_servers
    consumer = KafkaConsumer(topic, auto_offset_reset=kafka_offset_reset, bootstrap_servers=bootstrap_servers)
    logging.info("step3.已启动kafka")
    if isLoopReceiveData is False:
        loopReceiveData(consumer)